//
// Copyright (c) 2009-2011, chunquedong
//
// This file is part of ChunMap project
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
//
// History:
//   2011-09-04  Jed Young  Creation
//

**
** Tile
**
@Js
class Tile
{
  Int x
  Int y
  Int z

  new make(Int x, Int y, Int z)
  {
    this.x = x
    this.y = y
    this.z = z
  }

  override Int hash()
  {
    x.hash.xor(y.hash.shiftl(8)).xor(z.hash.shiftl(16))
  }

  override Bool equals(Obj? obj)
  {
    if (this === obj)  return true
    that := obj as Tile
    if (that == null) return false
    return this.x == that.x && this.y == that.y && this.z == that.z
  }

  override Str toStr() { "${x}_${y}_${z}" }
}